#include <iostream>
#include <string>
#include <vector>
#include <climits>
using namespace std;

int atoi(string s) {
    long long result = 0;
    vector<int> nums;
    bool startNum = false;
    bool typed = false;
    bool negative = false;
    for (int i = 0; i < s.size(); i++) {
        char curr = s[i];
        if (curr == ' ' && !startNum) { continue; }
        else if ((curr == '+' || curr == '-') && !typed) {
            negative = curr == '-'; typed = true; startNum = true;
        }
        else if ((int)curr >= 48 && (int)curr <= 57) {
            nums.push_back((int)curr - 48); typed = true; startNum = true;
        }
        else { break; }
    }
    long long power = 1;
    for (int i = 0; i < nums.size(); i++) {
        result = result * 10 + nums[i] * (negative ? -1 : 1);
        if (result >= INT_MAX) { return INT_MAX; }
        if (result <= INT_MIN) { return INT_MIN; }
    }
    return result;
}
// 与LeetCode上第8题一致，这道题我之前写过，我就直接把我通过的代码拿来了，
// https://leetcode.cn/problems/string-to-integer-atoi/

int main() {
    string target; cin >> target;
    int result = atoi(target);
    cout << result;
    return 0;
}